<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>人脸实名结果</title>
</head>
<body>
<h1 id="h1" style="font-size: 50px;margin-top: 30vh;text-align: center;color: #0d99fd"></h1>
<h1 id="h2" style="font-size: 38px;margin-top: 20px;text-align: center;color: #0d99fd"></h1>
</body>
</html>
<script>
  function GetQueryString(name) {
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    let r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
    let context = "";
    if (r != null)
      context = r[2];
    reg = null;
    r = null;
    return context == null || context == "" || context == "undefined" ? "" : context;
  }

  let h1 = document.getElementById('h1')
  let code = GetQueryString("code")
  if (code == '0') {
    h1.innerText = '人脸核验本人成功!'
  } else {
    h1.style.color = "#FF0000"
    h1.innerText = '实名核验失败!'
  }
  let liveRate = GetQueryString("liveRate")
  document.getElementById('h2').innerText = '本次人脸核身的活体检测分数：'+ liveRate

  let orderNo = GetQueryString("orderNo")
  const Http = new XMLHttpRequest();
  const url = 'http://chaxun.rongyica.com/prod-api/system/beiDiao/fvBack?orderNo=' + orderNo + '&code=' + code;
  Http.open("GET", url);
  Http.send();
  Http.onreadystatechange = (e) => {
    console.log(Http.responseText)
  }
</script>
